using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

using miciv;

namespace micivCore.Components
{
    public class CoZoneProto : ComponentPrototypeBase<CoZoneManager>
    {
        protected uint m_uX;
        protected uint m_uY;
        protected uint m_uWidth;
        protected uint m_uHeight;

        public CoZoneProto()
        {
        }

        override public bool Initialize(EntityPrototype _enProto, XmlElement _xmlConfig, IComponentManager _coManager)
        {
            if (false != base.Initialize(_enProto, _xmlConfig, _coManager))
            {
                XmlElement xmlPosition = _xmlConfig.SelectSingleNode("position") as XmlElement;
                this.m_uX = uint.Parse(xmlPosition.Attributes["x"].Value);
                this.m_uY = uint.Parse(xmlPosition.Attributes["y"].Value);
                XmlElement xmlSize = _xmlConfig.SelectSingleNode("size") as XmlElement;
                this.m_uWidth = uint.Parse(xmlSize.Attributes["x"].Value);
                this.m_uHeight = uint.Parse(xmlSize.Attributes["y"].Value);
                return true;
            }
            return false;
        }
    }

    public class CoZone : Level.LevelComponentBase<CoZoneProto>
    {
        public CoZone()
        {
        }

        override public bool Initialize(Entity _entity, IComponentPrototype _coProto)
        {
            if (false != base.Initialize(_entity, _coProto))
            {
                return true;
            }
            return false;
        }
    }
}
